<script setup lang="ts">
import useLoginStore from '@/store/login/login'
import { mapCrumbs } from '@/utils/mapmenu'
import { computed } from '@vue/reactivity'
import { storeToRefs } from 'pinia'
import { useRoute } from 'vue-router'

const crumbsValue = computed(() => {
  const route = useRoute()
  const loginStore = useLoginStore()
  const { userMenus } = storeToRefs(loginStore)

  const value = mapCrumbs(route.path, userMenus.value)
  return value
})
</script>

<template>
  <div class="header-crumbs">
    <el-breadcrumb separator-icon="ArrowRight">
      <template v-for="item in crumbsValue" :key="item.name">
        <el-breadcrumb-item :to="item.path">{{ item.name }}</el-breadcrumb-item>
      </template>
    </el-breadcrumb>
  </div>
</template>

<style lang="less" scoped>
.header-crumbs {
}
</style>
